<?php
$this->breadcrumbs = array(
    Shop::t('Cấu hình '.$data->name),
);
Shop::renderFlash();
?>
<div class="config-package radius-8px">
    <div class="view">
        <fieldset>
            <legend>Cấu hình <?php echo $data->name; ?> <span>( <?php echo CHtml::encode($data->desc); ?> )</span></legend>
        <?php
        foreach ($config->children() as $child) :
            $attr = $child->attributes();
            $category = Category::model()->findByPk($attr['id']);
            ?>
            <span class="config">
                <span class="name"><?php echo $category->name; ?></span>
                <span class="value"><?php echo $child ?></span>
            </span>
        <?php endforeach; ?>
        </fieldset>
    </div>
</div>
<div class="product-distributor">
    <?php
    foreach ($config->children() as $child) :
        $attr = $child->attributes();
        $category = Category::model()->findByPk($attr['id']);
        ?>
    <fieldset class="package-a">
            <legend class="radius-5px"><?php echo $category->name; ?></legend>
        <?php
        $products = new CActiveDataProvider('Product', array(
                    'criteria' => array(
                        'condition' => 'category_id = ' . $attr['id'] . ' AND description LIKE "%' . $child . '%"'
                    )
                ));
        $this->widget('zii.widgets.CListView', array(
            'dataProvider' => $products,
            'summaryText' => ' ',
            'itemView' => 'application.modules.shop.views.shop._product',
        ));
        ?>
        </fieldset>

<?php endforeach; ?>
</div>